package com.axt.dbaudit.bean.query.report;

import java.util.List;

import com.axt.dbaudit.base.MsgFuncExt;
import com.axt.dbaudit.base.QueryFilter;
import com.axt.dbaudit.base.QueryType;
import com.axt.dbaudit.base.StatDim;
import com.axt.dbaudit.bean.query.QueryBaseBean;
import com.axt.dbaudit.model.query.report.LoginByClientIp;
import com.axt.dbaudit.model.query.report.LoginByClientIpSort;
import com.axt.dbaudit.model.query.report.LoginByLoginName;
import com.axt.dbaudit.model.query.report.LoginByLoginNameSort;
import com.axt.dbaudit.model.query.report.LoginByTime;

public class QueryReportLoginBean extends QueryBaseBean{
	public List<LoginByTime> getLoingByTime() {
		try {
			return (List<LoginByTime>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<LoginByClientIp> getLoginByClientIp(){
		try {
			return (List<LoginByClientIp>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<LoginByClientIpSort> getLoginByClientIpSort(){
		try {
			return (List<LoginByClientIpSort>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<LoginByLoginName> getLoginByLoginName(){
		try {
			return (List<LoginByLoginName>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<LoginByLoginNameSort> getLoginByLoginNameSort(){
		try {
			return (List<LoginByLoginNameSort>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	/* stop query login report indices */
	public int stopQueryIndices(String serverPath) {

		init();
		setQueryType(QueryType.STAT_T_LOGIN);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_STOP_REPORT, serverPath);
	}

	// 按时间统计登录
	public int StatForFlowsByTimeRgn(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据时间范围统计 查询结果 */
	public int StatForFlowsByTimeRgnData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByTime");
	}
	
	// 按客户端Ip间统计登录
	public int StatForLoginsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据客户端Ip范围统计 查询结果 */
	public int StatForLoginsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByClientIp");
	}
	
	// 按客户端IP排序
	public int SortForLoginsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 按客户端IP排序 查询结果 */
	public int SortForLoginsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByClientIpSort");
	}
	
	// 根据登录名统计登录
	public int StatForLoginsByLoginName(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据登录名统计登录  查询结果 */
	public int StatForLoginsByLoginNameData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByLoginName");
	}
	
	// 根据登录名对登录进行排序
	public int SortForLoginsByLoginName(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据登录名对登录进行排序  查询结果 */
	public int SortForLoginsByLoginNameData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOGIN);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByLoginName");
	}
	
	// 成功登录的客户端IP排名
	public int SortForLoginsByCliIPSuccess(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_SLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 成功登录的客户端IP排名  查询结果 */
	public int SortForLoginsByCliIPSuccessData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_SLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByClientIpSort");
	}
	
	// 成功登录的登录名排名
	public int SortForLoginsByLoginNameSuccess(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_SLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 成功登录的登录名排名  查询结果 */
	public int SortForLoginsByLoginNameSuccessData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_SLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByLoginName");
	}
	
	// 失败登录的客户端IP排名
	public int SortForLoginsByCliIPFail(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 失败登录的客户端IP排名  查询结果 */
	public int SortForLoginsByCliIPFailData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByClientIpSort");
	}
	
	// 失败登录的登录名排名
	public int SortForLoginsByLoginNameFail(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 失败登录的登录名排名  查询结果 */
	public int SortForLoginsByLoginNameFailData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_FLOGIN);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_LOGIN_NAME);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.LoginByLoginName");
	}
}
